<!DOCTYPE html>
<html>
<head>
<title>选择项维护</title>
<jsp:include page="../../include/header.jsp" />
</head>
<body class="">
<form action="base/selectitem/selectitem!update.action" method="post" id="selectitemUpdateForm">
<input type="hidden" id="selecttypeId" name="selecttypeId" value="${selecttype.id}" />
<input type="hidden" id="moduleId" name="moduleId" value="${selecttype.module.id}" />
<c:if test="${parent ne null}">
	<input type="hidden" id="parentId" name="parentId" value="${parent.id}" />
</c:if>
<div class="breadcrumb">
	<c:choose>
		<c:when test="${parent eq null}">
			<a class="btn btn-success btn-small"
				href="base/selecttype/selecttype!listForUpdate.action?moduleId=${selecttype.module.id}">返回</a>
		</c:when>
		<c:when test="${parent.parent eq null}">
			<a class="btn btn-success btn-small"
				href="base/selectitem/selectitem!listForUpdate.action?selecttypeId=${selecttype.id}">返回</a>
		</c:when>
		<c:otherwise>
			<a class="btn btn-success btn-small"
				href="base/selectitem/selectitem!listForUpdate.action?parentId=${parent.parent.id}">返回</a>
		</c:otherwise>
	</c:choose>
	<a class="btn btn-success btn-small" id="btnAddSelectitem" href="javascript:;">添加新选项</a>
	<a class="btn btn-success btn-small" href="javascript:document.getElementById('selectitemUpdateForm').submit();">保存</a>
</div>
<div class="row-fluid">
	<div class="span4">所属模块: <span>${selecttype.module.name}</span></div>
	<div class="span4">选择项类型: <span>${selecttype.name}</span></div>
	<div class="span4">父选择项: <span><c:if test="${parent ne null}">${parent.name}</c:if></span></div>
</div>
<c:if test="${resultStatus!=null}">
	<c:choose>
		<c:when test="${resultStatus.success}">
			<div class="alert alert-success">
				<i class="icon-info-sign icon-large"></i>
				<button type="button" class="close" data-dismiss="alert">&times;</button>
				${resultStatus.message}
			</div>
		</c:when>
		<c:otherwise>
			<div class="alert alert-error">
				<i class="icon-info-sign icon-large"></i>
				<button type="button" class="close" data-dismiss="alert">&times;</button>
				${resultStatus.message}
			</div>
		</c:otherwise>
	</c:choose>
</c:if>
<table class="table table-striped" id="selectitemList">
	<thead>
		<tr>
			<th>ID</th>
			<th>选择项名称</th>
			<th>说明</th>
			<th>显示顺序</th>
			<th>图片</th>
			<th>子项</th>
			<th>删除</th>
		</tr>
	</thead>
	<tbody>
	<c:forEach var="selectitem" items="${selectitems}" varStatus="status">
		<tr>
			<td>
				<input type="hidden" name="selectitems[${status.index}].code" value="${selectitem.code}" />
				<input type="hidden" name="selectitems[${status.index}].module.id" value="${selectitem.module.id}" />
				<input type="hidden" name="selectitems[${status.index}].selecttype.id" value="${selectitem.selecttype.id}" />
				<c:if test="${selectitem.parent ne null}">
					<input type="hidden" name="selectitems[${status.index}].parent.id" value="${selectitem.parent.id}" />
				</c:if>
				<input type="text" readonly name="selectitems[${status.index}].id" value="${selectitem.id}" />
			</td>
			<td>
				<input type="text" name="selectitems[${status.index}].name" value="${selectitem.name}"/>
			</td>
			<td>
				<input type="text" name="selectitems[${status.index}].description" value="${selectitem.description}"/>
			</td>
			<td>
				<input type="text" class="width100" name="selectitems[${status.index}].dsporder" value="${selectitem.dsporder}"/>
			</td>
			<td>
				<input type="text" class="width100" name="selectitems[${status.index}].img" value="${selectitem.img}"/>
			</td>
			<td>
				<a href="base/selectitem/selectitem!listForUpdate.action?parentId=${selectitem.id}">编辑子项</a>
			</td>
			<td>
				<a class="btn btn-danger btn-small" href="base/selectitem/selectitem!delete.action?selecttypeId=${selecttype.id}&id=${selectitem.id}">删除</a>
			</td>
		</tr>
	</c:forEach>
	</tbody>
</table>
</form>
</body>
</html>
<script>
base.selectitem.initSelectitemUpdatePage();
</script>